using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;

namespace AmazonLiveWriterPlugin
{
    public partial class InsertForm : Form
    {
        public InsertForm()
        {
            InitializeComponent();
        }

        public string AmazonAssociatesID
        {
            get
            {
                return txtAssociatesID.Text;
            }
            set
            {
                txtAssociatesID.Text = value;
            }
        }

        public string AmazonWebServicesID
        {
            get
            {
                return txtWebServices.Text;
            }
            set
            {
                txtWebServices.Text = value;
            }
        }

        public string AmazonWebServicesSecretKey
        {
            get
            {
                return txtWebServicesSecretKey.Text;
            }
            set
            {
                txtWebServicesSecretKey.Text = value;
            }
        }

        public string CueCatData
        {
            get
            {
                return txtCueCatData.Text;
            }
            set
            {
                txtCueCatData.Text = value;
            }
        }

        private void txtWebServices_Validating(object sender, CancelEventArgs e)
        {
            if(txtWebServices.Text.Trim() == "")
            {
                e.Cancel = true;
                errorProvider.SetError(txtWebServices, "An Amazon Web Services shared key is required,");
                return;
            }
        }

        private void txtWebServicesSecretyKey_Validating(object sender, CancelEventArgs e)
        {
            if (txtWebServicesSecretKey.Text.Trim() == "")
            {
                e.Cancel = true;
                errorProvider.SetError(txtWebServicesSecretKey, "An Amazon Web Services secret key is required,");
                return;
            }
        }

        private void button1_Click(object sender, EventArgs e)
        {
            foreach(Control control in Controls)
            {
                control.Focus();
                if (!Validate())
                {
                    DialogResult = DialogResult.None;
                    return;
                }

            }
        }

        private void InsertForm_Load(object sender, EventArgs e)
        {
            if (txtAssociatesID.Text.Trim() != "" && txtWebServices.Text.Trim() != "" && txtWebServicesSecretKey.Text.Trim() != "")
            {
                txtCueCatData.Focus();
            }
        }

        private void txtWebServices_TextChanged(object sender, EventArgs e)
        {

        }

        private void txtWebServicesSecretKey_TextChanged(object sender, EventArgs e)
        {

        }

        private void lblAmazonWebServicesID_Click(object sender, EventArgs e)
        {

        }
    }
}